3.3.33 \(\int \tan (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx\) [233]

3.3.33.1 Optimal result
3.3.33.2 Mathematica [A] (verified)
3.3.33.3 Rubi [A] (verified)
3.3.33.4 Maple [A] (verified)
3.3.33.5 Fricas [A] (verification not implemented)
3.3.33.6 Sympy [A] (verification not implemented)
3.3.33.7 Maxima [A] (verification not implemented)
3.3.33.8 Giac [B] (verification not implemented)
3.3.33.9 Mupad [B] (verification not implemented)

3.3.33.1 Optimal result

Integrand size = 27, antiderivative size = 65 \[ \int \tan (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx=-((A b+a B) x)-\frac {(a A-b B) \log (\cos (c+d x))}{d}+\frac {(A b+a B) \tan (c+d x)}{d}+\frac {b B \tan ^2(c+d x)}{2 d} \]

output
-(A*b+B*a)*x-(A*a-B*b)*ln(cos(d*x+c))/d+(A*b+B*a)*tan(d*x+c)/d+1/2*b*B*tan 
(d*x+c)^2/d
 
3.3.33.2 Mathematica [A] (verified)

Time = 0.31 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.03 \[ \int \tan (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {-2 (A b+a B) \arctan (\tan (c+d x))+2 (-a A+b B) \log (\cos (c+d x))+2 (A b+a B) \tan (c+d x)+b B \tan ^2(c+d x)}{2 d} \]

input
Integrate[Tan[c + d*x]*(a + b*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]
 
output
(-2*(A*b + a*B)*ArcTan[Tan[c + d*x]] + 2*(-(a*A) + b*B)*Log[Cos[c + d*x]] 
+ 2*(A*b + a*B)*Tan[c + d*x] + b*B*Tan[c + d*x]^2)/(2*d)
 
3.3.33.3 Rubi [A] (verified)

Time = 0.37 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.222, Rules used = {3042, 4075, 3042, 4008, 3042, 3956}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \tan (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \tan (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x))dx\)

\(\Big \downarrow \) 4075

\(\displaystyle \int \tan (c+d x) (a A-b B+(A b+a B) \tan (c+d x))dx+\frac {b B \tan ^2(c+d x)}{2 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \tan (c+d x) (a A-b B+(A b+a B) \tan (c+d x))dx+\frac {b B \tan ^2(c+d x)}{2 d}\)

\(\Big \downarrow \) 4008

\(\displaystyle (a A-b B) \int \tan (c+d x)dx+\frac {(a B+A b) \tan (c+d x)}{d}-x (a B+A b)+\frac {b B \tan ^2(c+d x)}{2 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle (a A-b B) \int \tan (c+d x)dx+\frac {(a B+A b) \tan (c+d x)}{d}-x (a B+A b)+\frac {b B \tan ^2(c+d x)}{2 d}\)

\(\Big \downarrow \) 3956

\(\displaystyle \frac {(a B+A b) \tan (c+d x)}{d}-\frac {(a A-b B) \log (\cos (c+d x))}{d}-x (a B+A b)+\frac {b B \tan ^2(c+d x)}{2 d}\)

input
Int[Tan[c + d*x]*(a + b*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]
 
output
-((A*b + a*B)*x) - ((a*A - b*B)*Log[Cos[c + d*x]])/d + ((A*b + a*B)*Tan[c 
+ d*x])/d + (b*B*Tan[c + d*x]^2)/(2*d)
 

3.3.33.3.1 Defintions of rubi rules used

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3956
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d 
*x], x]]/d, x] /; FreeQ[{c, d}, x]
 

rule 4008
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.) 
*(x_)]), x_Symbol] :> Simp[(a*c - b*d)*x, x] + (Simp[b*d*(Tan[e + f*x]/f), 
x] + Simp[(b*c + a*d)   Int[Tan[e + f*x], x], x]) /; FreeQ[{a, b, c, d, e, 
f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]
 

rule 4075
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) 
+ (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[B 
*d*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e + f* 
x])^m*Simp[A*c - B*d + (B*c + A*d)*Tan[e + f*x], x], x] /; FreeQ[{a, b, c, 
d, e, f, A, B, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ[m, -1]
 
3.3.33.4 Maple [A] (verified)

Time = 0.04 (sec) , antiderivative size = 69, normalized size of antiderivative = 1.06

method result size
norman \(\left (-A b -B a \right ) x +\frac {\left (A b +B a \right ) \tan \left (d x +c \right )}{d}+\frac {b B \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {\left (a A -B b \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) \(69\)
derivativedivides \(\frac {\frac {b B \left (\tan ^{2}\left (d x +c \right )\right )}{2}+A \tan \left (d x +c \right ) b +B \tan \left (d x +c \right ) a +\frac {\left (a A -B b \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-A b -B a \right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) \(74\)
default \(\frac {\frac {b B \left (\tan ^{2}\left (d x +c \right )\right )}{2}+A \tan \left (d x +c \right ) b +B \tan \left (d x +c \right ) a +\frac {\left (a A -B b \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-A b -B a \right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) \(74\)
parts \(\frac {\left (A b +B a \right ) \left (\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}+\frac {a A \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {B b \left (\frac {\left (\tan ^{2}\left (d x +c \right )\right )}{2}-\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}\right )}{d}\) \(77\)
parallelrisch \(\frac {-2 A b d x -2 B x a d +b B \left (\tan ^{2}\left (d x +c \right )\right )+a A \ln \left (1+\tan ^{2}\left (d x +c \right )\right )+2 A \tan \left (d x +c \right ) b -B \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) b +2 B \tan \left (d x +c \right ) a}{2 d}\) \(79\)
risch \(-A b x -B a x +i A a x -i B b x +\frac {2 i a A c}{d}-\frac {2 i B b c}{d}+\frac {2 i \left (-i B b \,{\mathrm e}^{2 i \left (d x +c \right )}+A b \,{\mathrm e}^{2 i \left (d x +c \right )}+B a \,{\mathrm e}^{2 i \left (d x +c \right )}+A b +B a \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}-\frac {a \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) A}{d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B b}{d}\) \(143\)

input
int(tan(d*x+c)*(a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x,method=_RETURNVERBOSE)
 
output
(-A*b-B*a)*x+(A*b+B*a)*tan(d*x+c)/d+1/2*b*B*tan(d*x+c)^2/d+1/2*(A*a-B*b)/d 
*ln(1+tan(d*x+c)^2)
 
3.3.33.5 Fricas [A] (verification not implemented)

Time = 0.26 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.02 \[ \int \tan (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {B b \tan \left (d x + c\right )^{2} - 2 \, {\left (B a + A b\right )} d x - {\left (A a - B b\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 2 \, {\left (B a + A b\right )} \tan \left (d x + c\right )}{2 \, d} \]

input
integrate(tan(d*x+c)*(a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="frica 
s")
 
output
1/2*(B*b*tan(d*x + c)^2 - 2*(B*a + A*b)*d*x - (A*a - B*b)*log(1/(tan(d*x + 
 c)^2 + 1)) + 2*(B*a + A*b)*tan(d*x + c))/d
 
3.3.33.6 Sympy [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 104, normalized size of antiderivative = 1.60 \[ \int \tan (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\begin {cases} \frac {A a \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - A b x + \frac {A b \tan {\left (c + d x \right )}}{d} - B a x + \frac {B a \tan {\left (c + d x \right )}}{d} - \frac {B b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {B b \tan ^{2}{\left (c + d x \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (A + B \tan {\left (c \right )}\right ) \left (a + b \tan {\left (c \right )}\right ) \tan {\left (c \right )} & \text {otherwise} \end {cases} \]

input
integrate(tan(d*x+c)*(a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x)
 
output
Piecewise((A*a*log(tan(c + d*x)**2 + 1)/(2*d) - A*b*x + A*b*tan(c + d*x)/d 
 - B*a*x + B*a*tan(c + d*x)/d - B*b*log(tan(c + d*x)**2 + 1)/(2*d) + B*b*t 
an(c + d*x)**2/(2*d), Ne(d, 0)), (x*(A + B*tan(c))*(a + b*tan(c))*tan(c), 
True))
 
3.3.33.7 Maxima [A] (verification not implemented)

Time = 0.40 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.02 \[ \int \tan (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {B b \tan \left (d x + c\right )^{2} - 2 \, {\left (B a + A b\right )} {\left (d x + c\right )} + {\left (A a - B b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, {\left (B a + A b\right )} \tan \left (d x + c\right )}{2 \, d} \]

input
integrate(tan(d*x+c)*(a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="maxim 
a")
 
output
1/2*(B*b*tan(d*x + c)^2 - 2*(B*a + A*b)*(d*x + c) + (A*a - B*b)*log(tan(d* 
x + c)^2 + 1) + 2*(B*a + A*b)*tan(d*x + c))/d
 
3.3.33.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 556 vs. \(2 (63) = 126\).

Time = 0.51 (sec) , antiderivative size = 556, normalized size of antiderivative = 8.55 \[ \int \tan (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx=-\frac {2 \, B a d x \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + 2 \, A b d x \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + A a \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} + \tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right )^{2} \tan \left (c\right )^{2} - B b \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} + \tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 4 \, B a d x \tan \left (d x\right ) \tan \left (c\right ) - 4 \, A b d x \tan \left (d x\right ) \tan \left (c\right ) - B b \tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 2 \, A a \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} + \tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right ) \tan \left (c\right ) + 2 \, B b \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} + \tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right ) \tan \left (c\right ) + 2 \, B a \tan \left (d x\right )^{2} \tan \left (c\right ) + 2 \, A b \tan \left (d x\right )^{2} \tan \left (c\right ) + 2 \, B a \tan \left (d x\right ) \tan \left (c\right )^{2} + 2 \, A b \tan \left (d x\right ) \tan \left (c\right )^{2} + 2 \, B a d x + 2 \, A b d x - B b \tan \left (d x\right )^{2} - B b \tan \left (c\right )^{2} + A a \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} + \tan \left (c\right )^{2} + 1}\right ) - B b \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} + \tan \left (c\right )^{2} + 1}\right ) - 2 \, B a \tan \left (d x\right ) - 2 \, A b \tan \left (d x\right ) - 2 \, B a \tan \left (c\right ) - 2 \, A b \tan \left (c\right ) - B b}{2 \, {\left (d \tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 2 \, d \tan \left (d x\right ) \tan \left (c\right ) + d\right )}} \]

input
integrate(tan(d*x+c)*(a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="giac" 
)
 
output
-1/2*(2*B*a*d*x*tan(d*x)^2*tan(c)^2 + 2*A*b*d*x*tan(d*x)^2*tan(c)^2 + A*a* 
log(4*(tan(d*x)^2*tan(c)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(d*x)^2*tan(c)^2 + 
 tan(d*x)^2 + tan(c)^2 + 1))*tan(d*x)^2*tan(c)^2 - B*b*log(4*(tan(d*x)^2*t 
an(c)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(d*x)^2*tan(c)^2 + tan(d*x)^2 + tan(c 
)^2 + 1))*tan(d*x)^2*tan(c)^2 - 4*B*a*d*x*tan(d*x)*tan(c) - 4*A*b*d*x*tan( 
d*x)*tan(c) - B*b*tan(d*x)^2*tan(c)^2 - 2*A*a*log(4*(tan(d*x)^2*tan(c)^2 - 
 2*tan(d*x)*tan(c) + 1)/(tan(d*x)^2*tan(c)^2 + tan(d*x)^2 + tan(c)^2 + 1)) 
*tan(d*x)*tan(c) + 2*B*b*log(4*(tan(d*x)^2*tan(c)^2 - 2*tan(d*x)*tan(c) + 
1)/(tan(d*x)^2*tan(c)^2 + tan(d*x)^2 + tan(c)^2 + 1))*tan(d*x)*tan(c) + 2* 
B*a*tan(d*x)^2*tan(c) + 2*A*b*tan(d*x)^2*tan(c) + 2*B*a*tan(d*x)*tan(c)^2 
+ 2*A*b*tan(d*x)*tan(c)^2 + 2*B*a*d*x + 2*A*b*d*x - B*b*tan(d*x)^2 - B*b*t 
an(c)^2 + A*a*log(4*(tan(d*x)^2*tan(c)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(d*x 
)^2*tan(c)^2 + tan(d*x)^2 + tan(c)^2 + 1)) - B*b*log(4*(tan(d*x)^2*tan(c)^ 
2 - 2*tan(d*x)*tan(c) + 1)/(tan(d*x)^2*tan(c)^2 + tan(d*x)^2 + tan(c)^2 + 
1)) - 2*B*a*tan(d*x) - 2*A*b*tan(d*x) - 2*B*a*tan(c) - 2*A*b*tan(c) - B*b) 
/(d*tan(d*x)^2*tan(c)^2 - 2*d*tan(d*x)*tan(c) + d)
 
3.3.33.9 Mupad [B] (verification not implemented)

Time = 8.43 (sec) , antiderivative size = 63, normalized size of antiderivative = 0.97 \[ \int \tan (c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (A\,b+B\,a\right )+\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (\frac {A\,a}{2}-\frac {B\,b}{2}\right )-d\,x\,\left (A\,b+B\,a\right )+\frac {B\,b\,{\mathrm {tan}\left (c+d\,x\right )}^2}{2}}{d} \]

input
int(tan(c + d*x)*(A + B*tan(c + d*x))*(a + b*tan(c + d*x)),x)
 
output
(tan(c + d*x)*(A*b + B*a) + log(tan(c + d*x)^2 + 1)*((A*a)/2 - (B*b)/2) - 
d*x*(A*b + B*a) + (B*b*tan(c + d*x)^2)/2)/d